import request from '@/utils/request'

// 查询专利信息列表
export function listPatents(query) {
  return request({
    url: '/result/patents/list',
    method: 'get',
    params: query
  })
}

// 查询专利信息详细
export function getPatents(id) {
  return request({
    url: '/result/patents/' + id,
    method: 'get'
  })
}
/**
 * 根据多个id批量查询论文信息
 */
export function getPatentsByIds(ids) {
  return request({
    url: `/result/patents/getPatentsByIds`,
    method: 'get',
    params: { ids: ids.join(',') } // 将数组转换为逗号分隔的字符串
  });
}

/**
 * 根据id来查询专利信息
 */
export function getPatentById(id) {
  return request.get(`/result/patents/getPatentsById/${id}`);
}

// 新增专利信息
export function addPatents(data) {
  return request({
    url: '/result/patents',
    method: 'post',
    data: data
  })
}

// 修改专利信息
export function updatePatents(data) {
  return request({
    url: '/result/patents',
    method: 'put',
    data: data
  })
}

// 删除专利信息
export function delPatents(id) {
  return request({
    url: '/result/patents/' + id,
    method: 'delete'
  })
}
/**
 * 批量导出论文信息
 */
export function exportPatent(params) {
  return request.post(`/result/patents/export/patents`, params, {
    responseType: 'blob'
  });
}
